package com.droidblackbox.receiver;

import com.droidblackbox.manager.SystemManager;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;

public class GPSStateReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {

		String gs = Settings.Secure.getString(context.getContentResolver(),
				Settings.Secure.LOCATION_PROVIDERS_ALLOWED);

		if (gs.indexOf("gps", 0) > 0) {
			SystemManager.getInstance().setGps(true);
			SystemManager.getInstance().showToast(context, "GPS On");
		} else {
			SystemManager.getInstance().setGps(false);
			SystemManager.getInstance().showToast(context, "GPS Off");
		}

	}

}
